﻿var wAlert = window.alert;
window.alert = function (message) {
    try {
        var iframe = document.createElement("IFRAME");
        iframe.style.display = "none";
        iframe.setAttribute("src", 'data:text/plain,');
        document.documentElement.appendChild(iframe);
        var alertFrame = window.frames[0];
        var iwindow = alertFrame.window;
        if (iwindow == undefined) {
            iwindow = alertFrame.contentWindow;
        }
        iwindow.alert(message);
        iframe.parentNode.removeChild(iframe);
    }
    catch (exc) {
        return wAlert(message);
    }
}

window.confirm = function (message) {
    var iframe = document.createElement("IFRAME");
    iframe.style.display = "none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    var alertFrame = window.frames[0];
    var result = alertFrame.window.confirm(message);
    iframe.parentNode.removeChild(iframe);
    return result;
};

function readCookie(name) {
    var cookieValue = "";
    var search = name + "=";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = document.cookie.indexOf(";", offset);
            if (end == -1) end = document.cookie.length;
            cookieValue = unescape(document.cookie.substring(offset, end))
        }
    }
    return cookieValue;
}

function uppage() {
    if (history.length == 1) {
        location.href = "/m_index.html";
    }
    else {
        history.back(-1);
    }
}


function showNg() {
    $('#oneNgDiv').css('height', ($(window).height() +50));
    $("#oneNgDiv").animate({ left: '0px' });

    if ($("#MenuFade").length <= 0) {
        var html = "<div id=\"MenuFade\" onclick=\"hideNg()\"></div>";
        $(document.body).append(html);
        $('#MenuFade').css('width', $(window).width()).css('height', ($(window).height()+50));
    }
    else {
        $('#MenuFade').fadeIn();
    }

}
function hideNg() {
    $('#MenuFade').hide();
    $("#oneNgDiv").animate({ left: '-200px' });
    //$("#oneNgDiv").fadeOut();



}

//设置导航窗口参数
function NgSet() {
    $('#oneNgDiv').css('height', $(window).height());
    if ($("#MenuFade").length <= 0) {
        var html = "<div id=\"MenuFade\" onclick=\"hideNg()\"></div>";
        $(document.body).append(html);
    }
    $('#MenuFade').css('width', $(window).width()).css('height', $(window).height());
    //提示框设置居中
    //var top = ($(window).height() - $('#oneNgDiv').height()) / 2;
    //高度==浏览器的高-div的高/2
    //var left = ($(window).width() - $('#oneNgDiv').width()) / 2;
    //宽度同上
    //$('#oneNgDiv').css('top', top).css('left', left);
    //$('#oneNgDiv').css('left', left);

}